# 13 digit ISBN checker evenWeight=1 oddWeight=3 t=0 isbn=[9,7,8,1,4,4,4,1,8,2,2,6,2] #This is a 13 digit ISBN l=(len(isbn)) for i in range (0, l-1,2): t=t+ isbn[i]*evenWeight for i in range (1, l-1,2): t=t+isbn[i]*oddWeight remainder = t % 10 calcedCD= (10 -remainder) % 10 if isbn[l-1] == calcedCD: print("The calculated check digit matches the last digit") else: print("Oh no, they don't match!")